#pragma once

#include "Entity.h"

namespace Cartesia
{

	class Frame {
		public:
			float u, v, w, x;
	};


class CARTESIA_API Sprite : public Entity
{
public:

	uint			_textureId;
	VertexTexture	_vertices[4];

	uint			_textureWidth;
	uint			_textureHeight;
	bool			_hasAnimation;
	uint			_frameCount;
	uint			_currentFrame;
	uint			_frameWidth;
	uint			_frameHeight;
	Frame*			_frames;

	void Draw();

	void Load(char * fileName);
	void SetDim(float width, float height);
	void SetPos(float x, float y);
	void SetCoordsUV(int vertex, float coordu, float coordv);
	void Rotate(float angle);

	void CreateAnimation(uint frames, uint frameWidth, uint frameHeight);
	void UpdateAnimation(float time, float dt);
	void ResetAnimation() { _currentFrame = 0; SetAnimation(0); }
	void SetAnimation(uint frame);

	Sprite();
	~Sprite();

};

} // End Namespace Cartesia
